
package edu.ucla.cs.cs144;

import java.sql.* ;

public class MyDBManager
{
	static private String databaseURL = "jdbc:mysql://localhost:3306/";
	static private String dbname = "CS144";
	static private String username = "cs144";
	static private String password = "";
	
	public static Connection getConnection(boolean readOnly) throws SQLException 
	{        
		Connection conn = DriverManager.getConnection(databaseURL + dbname, username, password);
		conn.setReadOnly(readOnly);        
		return conn;
	}
	
	private MyDBManager() {}
	
	static 
	{
		try 
		{
			Class.forName("com.mysql.jdbc.Driver").newInstance();
		} 
		catch(Exception e) 
		{
			e.printStackTrace();
			throw new RuntimeException(e);
		}
	}
}
